//
//  SearchTableViewCell.m
//  Movie
//
//  Created by cjy on 16/3/31.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "SearchTableViewCell.h"
#import "MovieModel.h"
#import <UIImageView+WebCache.h>

@implementation SearchTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
    
    
    self.image = [[UIImageView alloc]init];
    [self.contentView addSubview:self.image];
    
    
    self.title = [[UILabel alloc]init];
    [self.contentView addSubview:self.title];
    
    self.rating = [[UILabel alloc]init];
    [self.contentView addSubview:self.rating];

    self.share_num = [[UILabel alloc]init];
    [self.contentView addSubview:self.share_num];


    }
    return self;

}


- (void)layoutSubviews{

    self.image.frame = CGRectMake(0, 0, self.contentView.frame.size.width / 3 , 100);
    
    self.title.frame = CGRectMake(self.contentView.frame.size.width / 3 + 10, 0, 200, 60);
    self.title.font = [UIFont boldSystemFontOfSize:14];
    
    self.rating.frame = CGRectMake(self.contentView.frame.size.width / 3 + 10, 60,  self.contentView.frame.size.width, 20);
    self.rating.font = [UIFont systemFontOfSize:13];
    
    self.share_num.frame = CGRectMake(self.contentView.frame.size.width / 3 + 100, 60,  self.contentView.frame.size.width, 20);
    self.share_num.font = [UIFont systemFontOfSize:13];

}

- (void)passModel:(MovieModel *)model{

    [self.image sd_setImageWithURL:[NSURL URLWithString:model.coverForDetail] placeholderImage:[UIImage imageNamed:@"zwt"]];
    self.title.numberOfLines = 0;

    self.title.textColor = [UIColor lightGrayColor];
    self.title.text = model.title;

    self.rating.text = [NSString stringWithFormat:@"评分:%@",model.rating];
    self.rating.textColor = [UIColor lightGrayColor];
    
    self.share_num.textColor = [UIColor lightGrayColor];
    self.share_num.text = [NSString stringWithFormat:@"喜欢:%@",model.share_num];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
